<div class="container">
  <page-header title="Admin">
  </page-header>

  <div class="bg-white tiled">
    <ul class="tab-nav">
      <li><a href="admin/status">System Status</a></li>
      <li><a href="admin/queries/tasks">Queries Queue</a></li>
      <li class="active"><a href="admin/queries/outdated">Outdated Queries</a></li>
    </ul>

    <div class="">
      <table class="table table-condensed table-hover">
        <thead>
        <tr>
          <th>Id</th>
          <th>Name</th>
          <th>Created By</th>
          <th>Runtime</th>
          <th>Last Executed At</th>
          <th>Created At</th>
          <th>Update Schedule</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="row in $ctrl.queries.getPageRows()">
          <td>
            {{row.data_source_id}}
          </td>
          <td>
            <a ng-href="queries/{{row.id}}">{{row.name}}</a>
          </td>
          <td>{{row.user.name}}</td>
          <td>{{row.runtime | durationHumanize}}</td>
          <td>{{row.retrieved_at | dateTime}}</td>
          <td>{{row.created_at | dateTime }}</td>
          <td>{{row.schedule | scheduleHumanize}}</td>
        </tr>
        </tbody>
      </table>
      <paginator paginator="$ctrl.queries"></paginator>

      <div class="p-15">
        <div class="badge">
          Last update: <span am-time-ago="updatedAt"></span>
        </div>
        (<label><input type="checkbox" ng-model="autoUpdate"> Auto Update</label>)
      </div>
    </div>
  </div>
</div>
